package com.servlet.model.base;

import java.io.Serializable;
import java.sql.Date;

/**
 * Profil d'un utilisateur dans la base de donnée
 * @author Jing Jing
 */
public class Profile extends PassiveAccount implements Serializable
{
	public static String[] moisValeur = { "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"};
	public static String[] worldAreas = { "Non precisé" , "Europe de l'ouest" , "Europe de l'est" , "Amerique de Nord", "Amerique du Sud", "Moyen Orient" , "Oceanie", "Asie", "Afrique" };
	private Status status;
	private String photo;
	private Area worldArea;
	private double prox;
	private int mode;
	/**
	 * Options de l'utilisateur
	 */
	private int nb_news_par_page;
	private int nb_contacts_par_page;
	private int niveau = 1;
	private int id;

	private boolean is_modified_nb_news_par_page;
	private boolean is_modified_nb_contacts_par_page;
	private boolean is_modified_status;
	private boolean is_modified_photo;
	private boolean is_modified_world_area;

	private final static int NBR_NEWS_PAR_PAGE = 10;
	private final static int NBR_CONTACTS_PAR_PAGE = 12;
	
	public Profile()
	{
		super();
		status = null;
		photo = null;
		worldArea = Area.areaVide;
		
		is_modified_status = false;
		is_modified_photo = false;
		is_modified_world_area = false;
		
		nb_news_par_page = NBR_NEWS_PAR_PAGE;
		nb_contacts_par_page = NBR_CONTACTS_PAR_PAGE;
		
		is_modified_nb_news_par_page = false;
		is_modified_nb_contacts_par_page = false;
	}
	
	public Profile(String email, String first_name,
			String last_name, Date birth_date) {
		super(email, first_name, last_name, birth_date);
		
		this.status = null;
		this.photo = null;
		this.worldArea = Area.areaVide;
		
		is_modified_status = false;
		is_modified_photo = false;
		is_modified_world_area = false;
		
		nb_news_par_page = 10;
		nb_contacts_par_page = 10;
		
		is_modified_nb_news_par_page = false;
		is_modified_nb_contacts_par_page = false;
	}
	
	public Profile(String email, String first_name,
			String last_name, Date birth_date,Status status, String photo, Area area , int nbc , int nbn ) {
		super(email,first_name, last_name, birth_date);
		
		this.status = status;
		this.photo = photo;
		this.worldArea = area;
		
		nb_news_par_page = nbn;
		nb_contacts_par_page = nbc;
		
		is_modified_nb_news_par_page = false;
		is_modified_nb_contacts_par_page = false;
		
		is_modified_status = false;
		is_modified_photo = false;
		is_modified_world_area = false;
	}
	
	public int getId()
	{
		return id;
	}
	
	public void setId(int id)
	{
		this.id = id;
	}
	
	public Status getStatus()
	{
		return status;
	}
	
	public String getPhoto()
	{
		return photo;
	}
	
	public Area getWorldArea()
	{
		return worldArea;
	}
	
	public String getMonth()
	{
		String date = birth_date.toString();
		String monthStr = date.substring(5, 6);
		int month = Integer.parseInt(monthStr);
		
		return moisValeur[month-1];
	}
	
	public int getMode()
	{
		return mode;
	}

	public boolean getIs_modified_status()
	{
		return is_modified_status;
	}
	
	public boolean getIs_modified_photo()
	{
		return is_modified_photo;
	}
	
	public boolean getIs_modified_world_area()
	{
		return is_modified_world_area;
	}
	
	
	public int getNiveau() {
		return niveau;
	}
	
	public void setIs_modified_status(boolean is_modified_status)
	{
		this.is_modified_status = is_modified_status;
	}
	
	public void setIs_modified_photo(boolean is_modified_photo)
	{
		this.is_modified_photo = is_modified_photo;
	}
	
	public void setIs_modified_world_area(boolean is_modified_world_area)
	{
		this.is_modified_world_area = is_modified_world_area;
	}
	
	public void setEmail(String email)
	{
		this.email = email;
	}
	
	public void setPhoto(String photo)
	{
		this.photo = photo;
		is_modified_photo = true;
	}
	
	public void setStatus(Status status)
	{
		this.status = status;
		is_modified_status = true;
	}
	
	public void setWorld_area(Area area)
	{
		this.worldArea = area;
		is_modified_world_area = true;
	}

	public void setProx(double prox)
	{
		this.prox = prox;
	}

	public double getProx()
	{
		return prox;
	}

	public void setMode(int i)
	{
		this.mode = i;
	}
	
	public int getNb_news_par_page()
	{
		return nb_news_par_page;
	}

	public int getNb_contacts_par_page()
	{
		return nb_contacts_par_page;
	}

	public void setNb_news_par_page(int nb_news_par_page)
	{
		this.nb_news_par_page = nb_news_par_page;
		is_modified_nb_news_par_page = true;
	}

	public void setNb_contacts_par_page(int nb_contacts_par_page)
	{
		this.nb_contacts_par_page = nb_contacts_par_page;
		is_modified_nb_contacts_par_page = true;
	}

	
	
	public boolean getIs_modified_nb_news_par_page()
	{
		return is_modified_nb_news_par_page;
	}

	public void setIs_modified_nb_news_par_page(boolean is_modified_nb_news_par_page)
	{
		this.is_modified_nb_news_par_page = is_modified_nb_news_par_page;
	}

	public boolean getIs_modified_nb_contacts_par_page()
	{
		return is_modified_nb_contacts_par_page;
	}

	public void setIs_modified_nb_contacts_par_page( boolean is_modified_nb_contacts_par_page)
	{
		this.is_modified_nb_contacts_par_page = is_modified_nb_contacts_par_page;
	}

	public void setNiveau(int i)
	{
		this.niveau = i;
	}
}
